package com.breaktian.share;

import com.example.foundation_share.R;

public enum ShareChannel {
    TIMELINE (1, "朋友圈"),
    SESSION (2, "微信好友"),
    WEIBO (3, "微博"),
    QQ (4, "QQ"),
    QZONE (5, "Q空间");

    private final String name;
    private final int type;

    public ShareEntity entry;

    ShareChannel(int type, String name){
        this.type = type;
        this.name = name;
    }

    public static ShareChannel from(int type){
        for(ShareChannel channel:values()){
            if(channel.type==type){
                return channel;
            }
        }
        return TIMELINE;
    }
    public String getName() {
        return name;
    }

    public int getType() {
        return type;
    }

    public int drawable() {
        switch (type) {
            case 1: return R.drawable.icon_share_timeline;
            case 2: return R.drawable.icon_share_session;
            case 3: return R.drawable.icon_share_weibo;
            case 4: return R.drawable.icon_share_qq;
            case 5: return R.drawable.icon_share_qzone;
        }
        return 0;
    }

}
